import time

import allure
from page_object.page_lg_login import PageLogin

from page_element.el_lg import *
import logging
from faker import Faker



class ProductShelves(PageLogin):
    def page_shelves_product(self, proid,proname):
        self.open_url(url)
        self.maximize_window()
        # 登录
        self.page_login('admin','123456')
        # 1.点击支付管理
        with allure.step("点击支付管理:"):
            self.click(pay_el.payment_loc)
            # 2.点击支付产品信息
        with allure.step(f"点击用户信息:"):
            self.click(pay_el.payinfo_loc)
            # 3.点击添加支付产品
        with allure.step("输入用户编号"):
            self.click(pay_el.addpay_loc)
        # 4.输入支付产品编码
        with allure.step("输入支付产品编码"):
            self.send_keys(pay_el.productid_input,proid)
        # 5.输入支付产品名称
        time.sleep(8)
        # with allure.step("输入支付产品名称"):
        #     self.send_keys(pay_el.proname_input,proname)
        # 6.点击提交
        with allure.step(f"点击提交:"):
            self.click(pay_el.commit_loc)
            time.sleep(1)
        proname = self.text(pay_el.proname_loc)
        assert proname != ''
#         # 7.点击设置支付方式
#         with allure.step(f"点击设置支付方式:"):
#             self.click(pay_el.cpayment_loc)
#         # 8.点击添加支付方式
#         time.sleep(2)
#         with allure.step(f"点击添加支付方式:"):
#             self.click(pay_el.addpayment_loc)
#         # 9.输入支付费率
#         with allure.step(f"输入支付费率:"):
#             self.send_keys(pay_el.pay_lv,pay_lv)
#             time.sleep(1)
#         # 10.点击提交
#         with allure.step(f"点击提交:"):
#             self.click(pay_el.commit_loc)
#         # 11.点击支付产品信息
#         with allure.step(f"点击用户信息:"):
#             self.click(pay_el.payinfo_loc)
#         # 12.点击上架
#         with allure.step(f"点击上架:"):
#             self.click(pay_el.shelves_loc)
# #         13.点击确定
#         with allure.step(f"点击确定:"):
#             self.click(pay_el.shelves_right)
#         try:
#             dy_offsh = self.text(pay_el.dy_offshelves)
#             logging.info(f'=============dy_offsh======={dy_offsh}========')
#             assert dy_offsh == '下架'
#         except Exception as e:
#             print(e)




